<nav class="navbar navbar-default" role="navigation">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <a class="navbar-brand" href="/">Blog Test</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav navbar-right">
       <% if !current_devise_user %>
         <li> <%= link_to("注册", new_devise_user_registration_path) %> </li>
         <li> <%= link_to("登陆", new_devise_user_session_path) %> </li>
       <% else %>
         <li class="dropdown">
           <a href="#" class="dropdown-toggle" data-toggle="dropdown">
             你好, <%= current_devise_user.name ||= current_devise_user.email %>
             <b class="caret"></b>
           </a>
           <ul class="dropdown-menu">
             <li> <%= current_devise_user.email %> </li>
             <li> <%= link_to("我的博客", blogs_path) %> </li>
             <li> <%= link_to("我的类别", categories_path) %> </li>
             <li> <%= link_to("帐号设置", edit_devise_user_registration_path) %> </li>
             <li> <%= link_to("退出", destroy_devise_user_session_path, method: :delete) %> </li>
           </ul>
         </li>
       <% end %>
      </ul>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>